Fix WAVE accessibility errors for local video generation#47
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Comment |
Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR addresses WAVE accessibility errors when generating local video content by implementing proper ARIA labeling and alternative text handling. The changes ensure compliance with accessibility standards while maintaining backward compatibility.
- Add
aria-labelattributes to local video/audio players for proper screen reader support - Implement fallback alt text for poster images when empty alt attributes are provided
- Maintain existing functionality while improving accessibility compliance
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Problem
When generating local videos using the
generate()method, the WAVE accessibility checker reported two errors:<media-poster>elements with emptyalt=""attributes<media-player>missing proper ARIA labeling for local videosExample code that triggered the errors:
Solution
This PR implements two minimal fixes to resolve both accessibility issues:
1. Add
aria-labelto local video/audio playersFor local videos and audio files, the
<media-player>element now includes anaria-labelattribute:<media-video-layout>componentBefore:
After:
2. Poster alt text fallback
When a poster is set without alt text via
setPoster($src, ''), the video title is now used as a fallback:setPoster($src, $alt)is still preservedBefore:
After:
Impact
Testing
Verified across multiple scenarios:
aria-labeluses titlearia-labeluses generic labelAll WAVE accessibility errors are now resolved.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.